﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace ch2
{
    class Program
    {
        static void Main(string[] args)
        {
            #region base
            var i = 10;
            Console.WriteLine(i);

            var d = 0.1;
            Console.WriteLine(d);

            var yellow = Color.Yellow;
            var stringYellow = Enum.Parse<Color>("Yellow");
            if (yellow == stringYellow)
            {
                Console.WriteLine(true);
            }

            int? index = 0;
            if (index.HasValue)
            {
                Console.WriteLine(index.Value);
            }

            index = null;
            if (index.HasValue)
            {
                Console.WriteLine(index.Value);
            }

            Console.WriteLine(index ?? 0);

            var demo = new Demo
            {
                Color = yellow
            };
            #endregion

            //1. 线性表
            int[] arr = new int[10];
            arr[1] = 1;
            Console.WriteLine(arr[0]);

            //2. 链表
            var list = new List<int>(8);
            list.Add(1);
            Console.WriteLine(list[0]);

            //3. 广义表, 键值对
            var dic = new Dictionary<int, int>();
            dic.Add(1, 1);
            Console.WriteLine(dic[1]);

            //其他集合: 
            Stack<int> stack1 = new Stack<int>();
            stack1.Push(1);
            Console.WriteLine(stack1.Pop());

            Queue<int> queue = new Queue<int>();
            queue.Enqueue(1);
            Console.WriteLine(queue.Dequeue());

            //IEnumerable<int> x;
            //ICollection<int> y;

            string str = "tr\"ue";
            var str1 = @"select * from User
                        where Name like '%张三%'
                        and Age > 10
                        and Age < 30";
            var str2 = @$"true: {queue.Count,10}, {DateTime.Now}";
            if (str == str1 || str.Equals(str1))
            {
                Console.WriteLine(str1);
            }

            Console.WriteLine("Hello World!");
        }
    }

    [Flags]
    enum Color
    {
        /// <summary>
        /// 0001
        /// </summary>
        Red = 0x01,
        /// <summary>
        /// 0010
        /// </summary>
        Green = 0x02,
        /// <summary>
        /// 0100
        /// </summary>
        Blue = 0x04,
        Yellow = Green & Blue
    }

    class Demo
    {
        public Demo()
        {
            Color = Color.Red;
        }

        public string Name { get; set; }
        public int Ace { get; set; }
        public Color Color { get; set; }

        public Demo DemoValue { get; set; }
    }
}